export interface History {
  id: string;
  date: number;
  desc: string[];
}
export interface createHistory {
  date: number;
  desc: string[];
}
export interface updateHistory {
  date?: number;
  desc?: string[];
}

export const create = (data: createHistory) => {
  return useServerRequest<History>("/histories", {
    method: "POST",
    body: { ...data },
  });
};

export const findAll = () => {
  return useServerRequest<History[]>("/histories", {
    method: "GET",
  });
};
export const findOne = (id: string) => {
  return useServerRequest<History>(`/histories/${id}`, {
    method: "GET",
  });
};
export const update = (id: string, body: updateHistory) => {
  return useServerRequest(`/histories/${id}`, {
    method: "PATCH",
    body: body,
  });
};
export const deleteHistory = (id: string) => {
  return useServerRequest(`/histories/${id}`, {
    method: "DELETE",
    body: {},
  });
};
